package com.khalil.kkadmin.common.exception;

import lombok.Getter;

@Getter
public enum ExceptionEnum {
    NOT_FOUND("1404", "资源不存在"),
    BAD_REQUEST("1405", "请求参数错误"),
    USER_NOT_EXIST("10001", "用户不存在"),
    USER_PASSWORD_ERROR("10002", "用户密码错误"),
    USER_NOT_LOGIN("10003", "用户未登录"),
    USER_ERROR_CAPTCHA("10005", "验证码错误");

    private String code;
    private String msg;

    private ExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ExceptionEnum getByCode(String code) {
        for (ExceptionEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
